<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/style.css" />
    <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/bootstrap.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/ckform.js"></script>
    <script type="text/javascript" src="__PUBLIC__/Js/common.js"></script>

 

    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
<form  method="post" class="definewidth m20">
<input type="hidden" name="id" value="<?php echo ($user["id"]); ?>" />
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td class="tableleft">图片地址</td>
            <td><input id="imagesurl" type="text" name="imagesurl"  /></td>
        </tr>
        <tr>
        <tr>
            <td class="tableleft">商店名称</td>
            <td><input id="name" type="text" name="name" /></td>
        </tr>
        <tr>
        <tr>
            <td class="tableleft">点击数</td>
            <td><input id="praise" type="text" name="praise" /></td>
        </tr>
        <tr>
            <td class="tableleft">城市号</td>
            <td><input id="city" type="text" name="city"  /></td>
        </tr>
        <tr>
            <td class="tableleft">是否显示（1显示0不显示）</td>
            <td><input id="loss" type="text" name="loss" /></td>
        </tr>
        <tr>
            <td class="tableleft">结束日期</td>
            <td><input id="end_time" type="text" name="end_time" /></td>
        </tr>
        <tr>
            <td class="tableleft">商圈</td>
            <td><input id="shangqu" type="text" name="shangqu" /></td>
        </tr>
        <tr>
            <td class="tableleft">店铺号</td>
            <td><input id="sid" type="text" name="sid" /></td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <button type="button" onclick="save()" class="btn btn-primary" type="button">保存</button>				 &nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
            </td>
        </tr>
    </table>
</form>
</body>
</html>

<script>
    function save(){

        var imagesurl = $('#imagesurl').val();
        var name = $('#name').val();
        var praise =$('#praise').val();
        var city = $('#city').val();
        var loss =$('#loss').val();
        var end_time =$('#end_time').val();
        var shangqu =$('#shangqu').val();
        var sid =$('#sid').val();


        if( !imagesurl || !name || !praise || !city || !loss || !end_time  || !sid){
            alert('请把信息补全!');
            return;
        }

        $.ajax({
            type : "post",
            dataType : "text",
            url : "<?php echo U('Data/addshuju');?>",
            data : {
                imagesurl : imagesurl,
                name : name,
                praise : praise,
                city : city,
                loss : loss,
                end_time : end_time,
                shangqu : shangqu,
                sid : sid
            },
            success : function(msg) {
                console.log(msg);
                //alert(msg);
                if (msg == 0) {
                    window.location.href = "<?php echo U('Activity/index');?>";
                    alert('保存成功'+msg);
                }

            }
        });
    }

    $(function () {
        $('#backid').click(function(){
            window.location.href="index.html";
        });

    });
</script>